<?php
/**
 * Created by PhpStorm.
 * User: 戎大富
 * Date: 2020/8/4
 * Time: 15:35
 */
namespace app\api\controller;
use think\Db;
class Order extends Base {
    /**
     * 异地登录验证
     * @return string
     */
    public function __construct()
    {
        extract(input());
        $auth = $this->checkAll($user_id,$time,$value,$reqKey);
        if($auth == 112){
            echo json_encode(['status'=>301,'msg'=>$this->otherLogin]);
            exit;
        }elseif($auth == 110){
            echo json_encode(['status' => 302, 'msg' => $this->frost]);
            exit;
        }
    }
    //搜索
    public function index(){
        extract(input());
        $page = input('param.page')?input('param.page'):1;
        $num = 10;
        $limit = ($page-1)*$num;
        $keyword = input('param.keyword');
        $res = array();
        if($keyword==''){
            return json(['status'=>200,'msg'=>$res]);
        }else{
            $map['district'] = array('like',"%$keyword%");
            $district_id= Db::table('up_area')->where($map)->column('district_id');
            if(count($district_id)>0){
             $where['a.order_go_sheng|a.order_go_shi|a.order_to_sheng|a.order_to_shi'] = array('IN',$district_id);
          }else{
                return json(['status'=>200,'msg'=>$res]);
            }
        }
        $where['a.order_type'] = array('not in',array(3,4));
        $where['a.order_status'] = array('>',1);
        $res = Db::table('up_order')->alias('a')
            ->join('up_car_hwlx uch','uch.hwlx_id = a.hwlx_id','left')
            ->join('up_car_zxlx ucz','ucz.zxlx_id = a.zxlx_id','left')
            ->join('up_area ua','ua.district_id = a.order_go_sheng')
            ->join('up_area ua1','ua1.district_id = a.order_go_shi')
            ->join('up_area ua2','ua2.district_id = a.order_to_sheng')
            ->join('up_area ua3','ua3.district_id = a.order_to_shi')
            ->join('up_u_user uuu','uuu.user_id = a.order_qy_user')
            ->limit($limit,$num)
            ->where($where)
            ->order('a.order_fb_time desc')
            ->field('a.order_num,a.jiesuan,a.order_true,ucz.zxlx_name,a.order_goods_m,a.order_type,a.order_status,a.order_fb_time,a.cx_id as cx_name,uch.hwlx_name,
            a.order_cc,a.order_goods_ton,a.order_zc_time,
            a.order_id,ua.district as go_sheng,ua1.district as go_shi,
            ua2.district as to_sheng,ua3.district as to_shi,uuu.user_image,uuu.user_phone,uuu.user_username,uuu.user_real_name')
            ->select();
        return json(['status' => 200, 'msg' => $res]);
    }

    //订单列表
    public function orderList(){
        extract(input());
        $type = input('param.type');//1询价  2进行中  3代付款 4已完成  5全部订单
        $page = input('param.page')?input('param.page'):1;
        $num = 10;
        $limit = ($page-1)*$num;
        $where['a.order_qy_user'] = $user_id;
        if($type==1){//询价
            $where['a.order_type'] = 1;
            $where['a.order_status'] = array('IN',array(1,2,3,4));
            $res = Db::table('up_order')->alias('a')
                ->join('up_car_hwlx uch','uch.hwlx_id = a.hwlx_id','left')
                ->join('up_car_zxlx ucz','ucz.zxlx_id = a.zxlx_id','left')
                ->join('up_area ua','ua.district_id = a.order_go_sheng','left')
                ->join('up_area ua1','ua1.district_id = a.order_go_shi','left')
                ->join('up_area ua2','ua2.district_id = a.order_to_sheng','left')
                ->join('up_area ua3','ua3.district_id = a.order_to_shi','left')
                ->join('up_u_user uuu','uuu.user_id = a.order_jms_user','left')
                ->limit($limit,$num)
                ->where($where)
                ->order('a.order_fb_time desc')
                ->field('a.order_num,a.jiesuan,a.order_true,ucz.zxlx_name,a.order_goods_m,a.order_type,a.order_status,a.order_fb_time,a.cx_id as cx_name,uch.hwlx_name,
            a.order_cc,a.order_goods_ton,a.order_zc_time,a.order_go_lon,a.order_go_lat,a.order_to_lon,a.order_to_lat,a.order_zcsj_time,
            a.order_id,ua.district as go_sheng,ua1.district as go_shi,
            ua2.district as to_sheng,ua3.district as to_shi,uuu.user_image,uuu.user_phone,uuu.user_username,uuu.user_real_name')
                ->select();
            return json(['status' => 200, 'msg' => $res]);
        }elseif ($type==2){//进行中
            $where['a.order_status'] = array('IN',array(5,6));
            $where['a.order_type'] = 2;
            $map['a.order_type'] = 1;
            $map['a.order_status'] =array('IN',array(5,6));
            $map['a.order_true'] =1;
            $map['a.order_qy_user'] = $user_id;
            $res = Db::table('up_order')->alias('a')
                ->join('up_car_hwlx uch','uch.hwlx_id = a.hwlx_id','left')
                ->join('up_car_zxlx ucz','ucz.zxlx_id = a.zxlx_id','left')
                ->join('up_area ua','ua.district_id = a.order_go_sheng','left')
                ->join('up_area ua1','ua1.district_id = a.order_go_shi','left')
                ->join('up_area ua2','ua2.district_id = a.order_to_sheng','left')
                ->join('up_area ua3','ua3.district_id = a.order_to_shi','left')
                ->join('up_u_user uuu','uuu.user_id = a.order_jms_user','left')
                ->limit($limit,$num)
                ->where(function ($query) use($where){
                    $query->where($where);
                })
                ->whereOr(function ($query) use($map){
                    $query->where($map);
                })
                ->order('a.order_fb_time desc')
                ->field('a.order_num,a.jiesuan,a.order_true,ucz.zxlx_name,a.order_goods_m,a.order_type,a.order_status,a.order_fb_time,a.cx_id as cx_name,uch.hwlx_name,
            a.order_cc,a.order_goods_ton,a.order_zc_time,a.order_go_lon,a.order_go_lat,a.order_to_lon,a.order_to_lat,a.order_zcsj_time,
            a.order_id,ua.district as go_sheng,ua1.district as go_shi,
            ua2.district as to_sheng,ua3.district as to_shi,uuu.user_image,uuu.user_phone,uuu.user_username,uuu.user_real_name')
                ->select();
            return json(['status' => 200, 'msg' => $res]);
        } elseif ($type==3){//待付款
            $where['a.order_type'] = array('not in',array(3,4));
            $where['a.order_status'] = array('IN',array(8,9));
            $where['a.jiesuan'] = 1;
            $res = Db::table('up_order')->alias('a')
                ->join('up_car_hwlx uch','uch.hwlx_id = a.hwlx_id','left')
                ->join('up_car_zxlx ucz','ucz.zxlx_id = a.zxlx_id','left')
                ->join('up_area ua','ua.district_id = a.order_go_sheng','left')
                ->join('up_area ua1','ua1.district_id = a.order_go_shi','left')
                ->join('up_area ua2','ua2.district_id = a.order_to_sheng','left')
                ->join('up_area ua3','ua3.district_id = a.order_to_shi','left')
                ->join('up_u_user uuu','uuu.user_id = a.order_jms_user','left')
                ->limit($limit,$num)
                ->where($where)
                ->order('a.order_fb_time desc')
                ->field('a.order_num,a.jiesuan,a.order_true,ucz.zxlx_name,a.order_goods_m,a.order_type,a.order_status,a.order_fb_time,a.cx_id as cx_name,uch.hwlx_name,
            a.order_cc,a.order_goods_ton,a.order_zc_time,a.order_go_lon,a.order_go_lat,a.order_to_lon,a.order_to_lat,a.order_zcsj_time,
            a.order_id,ua.district as go_sheng,ua1.district as go_shi,
            ua2.district as to_sheng,ua3.district as to_shi,uuu.user_image,uuu.user_phone,uuu.user_username,uuu.user_real_name')
                ->select();
            return json(['status' => 200, 'msg' => $res]);
        }elseif ($type==4){//已完成
            $where['a.order_type'] = array('not in',array(3,4));
            $where['a.order_status'] = array('IN',array(8,9));
            $where['a.jiesuan'] = 2;
            $res = Db::table('up_order')->alias('a')
                ->join('up_car_hwlx uch','uch.hwlx_id = a.hwlx_id','left')
                ->join('up_car_zxlx ucz','ucz.zxlx_id = a.zxlx_id','left')
                ->join('up_area ua','ua.district_id = a.order_go_sheng','left')
                ->join('up_area ua1','ua1.district_id = a.order_go_shi','left')
                ->join('up_area ua2','ua2.district_id = a.order_to_sheng','left')
                ->join('up_area ua3','ua3.district_id = a.order_to_shi','left')
                ->join('up_u_user uuu','uuu.user_id = a.order_jms_user','left')
                ->limit($limit,$num)
                ->where($where)
                ->order('a.order_fb_time desc')
                ->field('a.order_num,a.jiesuan,a.order_true,ucz.zxlx_name,a.order_goods_m,a.order_type,a.order_status,a.order_fb_time,a.cx_id as cx_name,uch.hwlx_name,
            a.order_cc,a.order_goods_ton,a.order_zc_time,a.order_go_lon,a.order_go_lat,a.order_to_lon,a.order_to_lat,a.order_zcsj_time,
            a.order_id,ua.district as go_sheng,ua1.district as go_shi,
            ua2.district as to_sheng,ua3.district as to_shi,uuu.user_image,uuu.user_phone,uuu.user_username,uuu.user_real_name')
                ->select();
            return json(['status' => 200, 'msg' => $res]);
        }elseif ($type==5){//全部订单
            $where['a.order_type'] = array('not in',array(4));
            $res = Db::table('up_order')->alias('a')
                ->join('up_car_hwlx uch','uch.hwlx_id = a.hwlx_id','left')
                ->join('up_car_zxlx ucz','ucz.zxlx_id = a.zxlx_id','left')
                ->join('up_area ua','ua.district_id = a.order_go_sheng','left')
                ->join('up_area ua1','ua1.district_id = a.order_go_shi','left')
                ->join('up_area ua2','ua2.district_id = a.order_to_sheng','left')
                ->join('up_area ua3','ua3.district_id = a.order_to_shi','left')
                ->join('up_u_user uuu','uuu.user_id = a.order_jms_user','left')
                ->limit($limit,$num)
                ->where($where)
                ->order('a.order_fb_time desc')
                ->field('a.order_num,a.jiesuan,a.order_true,ucz.zxlx_name,a.order_goods_m,a.order_type,a.order_status,a.order_fb_time,a.cx_id as cx_name,uch.hwlx_name,
            a.order_cc,a.order_goods_ton,a.order_zc_time,a.order_go_lon,a.order_go_lat,a.order_to_lon,a.order_to_lat,a.order_zcsj_time,
            a.order_id,ua.district as go_sheng,ua1.district as go_shi,
            ua2.district as to_sheng,ua3.district as to_shi,uuu.user_image,uuu.user_phone,uuu.user_username,uuu.user_real_name')
                ->select();
            return json(['status' => 200, 'msg' => $res]);
        }elseif ($type==6){//发布中
            $where['a.order_type'] = array('IN',array(2,3));
            $where['a.order_status'] = array('IN',array(1,2,3,4));
            $res = Db::table('up_order')->alias('a')
                ->join('up_car_hwlx uch','uch.hwlx_id = a.hwlx_id','left')
                ->join('up_car_zxlx ucz','ucz.zxlx_id = a.zxlx_id','left')
                ->join('up_area ua','ua.district_id = a.order_go_sheng','left')
                ->join('up_area ua1','ua1.district_id = a.order_go_shi','left')
                ->join('up_area ua2','ua2.district_id = a.order_to_sheng','left')
                ->join('up_area ua3','ua3.district_id = a.order_to_shi','left')
                ->join('up_u_user uuu','uuu.user_id = a.order_jms_user','left')
                ->limit($limit,$num)
                ->where($where)
                ->order('a.order_fb_time desc')
                ->field('a.order_num,a.jiesuan,a.order_true,ucz.zxlx_name,a.order_goods_m,a.order_type,a.order_status,a.order_fb_time,a.cx_id as cx_name,uch.hwlx_name,
            a.order_cc,a.order_goods_ton,a.order_zc_time,a.order_go_lon,a.order_go_lat,a.order_to_lon,a.order_to_lat,a.order_zcsj_time,
            a.order_id,ua.district as go_sheng,ua1.district as go_shi,
            ua2.district as to_sheng,ua3.district as to_shi,uuu.user_image,uuu.user_phone,uuu.user_username,uuu.user_real_name')
                ->select();
            return json(['status' => 200, 'msg' => $res]);
        }
    }
    //订单数字提示
    public function orderListNum(){
        extract(input());
        //询价
        $where['a.order_qy_user'] = $user_id;
        $where['a.order_type'] = 1;
        $where['a.order_status'] = array('IN',array(1,2,3,4));
        $num = Db::table('up_order')->alias('a')
            ->join('up_car_hwlx uch','uch.hwlx_id = a.hwlx_id','left')
            ->join('up_car_zxlx ucz','ucz.zxlx_id = a.zxlx_id','left')
            ->join('up_area ua','ua.district_id = a.order_go_sheng','left')
            ->join('up_area ua1','ua1.district_id = a.order_go_shi','left')
            ->join('up_area ua2','ua2.district_id = a.order_to_sheng','left')
            ->join('up_area ua3','ua3.district_id = a.order_to_shi','left')
            ->join('up_u_user uuu','uuu.user_id = a.order_jms_user','left')
            ->where($where)
            ->count();
        //进行中
        $where1['a.order_status'] = array('IN',array(5,6));
        $where1['a.order_type'] = 2;
        $where1['a.order_qy_user'] = $user_id;
        $map['a.order_type'] = 1;
        $map['a.order_status'] =array('IN',array(5,6));
        $map['a.order_true'] =1;
        $map['a.order_qy_user'] = $user_id;
        $num1= Db::table('up_order')->alias('a')
            ->join('up_car_hwlx uch','uch.hwlx_id = a.hwlx_id','left')
            ->join('up_car_zxlx ucz','ucz.zxlx_id = a.zxlx_id','left')
            ->join('up_area ua','ua.district_id = a.order_go_sheng','left')
            ->join('up_area ua1','ua1.district_id = a.order_go_shi','left')
            ->join('up_area ua2','ua2.district_id = a.order_to_sheng','left')
            ->join('up_area ua3','ua3.district_id = a.order_to_shi','left')
            ->join('up_u_user uuu','uuu.user_id = a.order_jms_user','left')
            ->where(function ($query) use($where1){
                $query->where($where1);
            })
            ->whereOr(function ($query) use($map){
                $query->where($map);
            })
            ->count();
        //待付款
        $where2['a.order_type'] = array('not in',array(3,4));
        $where2['a.order_status'] = array('IN',array(8,9));
        $where2['a.jiesuan'] = 1;
        $where2['a.order_qy_user'] = $user_id;
        $num2 = Db::table('up_order')->alias('a')
            ->join('up_car_hwlx uch','uch.hwlx_id = a.hwlx_id','left')
            ->join('up_car_zxlx ucz','ucz.zxlx_id = a.zxlx_id','left')
            ->join('up_area ua','ua.district_id = a.order_go_sheng','left')
            ->join('up_area ua1','ua1.district_id = a.order_go_shi','left')
            ->join('up_area ua2','ua2.district_id = a.order_to_sheng','left')
            ->join('up_area ua3','ua3.district_id = a.order_to_shi','left')
            ->join('up_u_user uuu','uuu.user_id = a.order_jms_user','left')
            ->where($where2)
            ->count();
        //发布中
        $where3['a.order_type'] = array('IN',array(2,3));
        $where3['a.order_status'] = array('IN',array(1,2,3,4));
        $where3['a.order_qy_user'] = $user_id;
        $num3 = Db::table('up_order')->alias('a')
            ->join('up_car_hwlx uch','uch.hwlx_id = a.hwlx_id','left')
            ->join('up_car_zxlx ucz','ucz.zxlx_id = a.zxlx_id','left')
            ->join('up_area ua','ua.district_id = a.order_go_sheng','left')
            ->join('up_area ua1','ua1.district_id = a.order_go_shi','left')
            ->join('up_area ua2','ua2.district_id = a.order_to_sheng','left')
            ->join('up_area ua3','ua3.district_id = a.order_to_shi','left')
            ->join('up_u_user uuu','uuu.user_id = a.order_jms_user','left')
            ->where($where3)
            ->count();
        $res['xj'] = $num;
        $res['jxz'] = $num1;
        $res['dfk'] = $num2;
        $res['fbz'] = $num3;
        return json(['status' => 200, 'msg' => $res]);
    }
    //订单详情
    public function detailOrder(){
        extract(input());
        $id = input('param.order_id');
        $where['a.order_id'] = $id;
        $info = Db::table('up_order')->alias('a')->where($where)->field('order_type')->find();
        if($info['order_type']==1){//询价单
            $res = Db::table('up_order')->alias('a')
                ->join('up_car_hwlx uch','uch.hwlx_id = a.hwlx_id','left')
                ->join('up_area ua','ua.district_id = a.order_go_sheng','left')
                ->join('up_area ua1','ua1.district_id = a.order_go_shi','left')
                ->join('up_area ua2','ua2.district_id = a.order_to_sheng','left')
                ->join('up_area ua3','ua3.district_id = a.order_to_shi','left')
                ->join('up_u_user uuu','uuu.user_id = a.order_jms_user','left')
                ->join('up_car_zxlx ucz' ,'ucz.zxlx_id = a.zxlx_id','left')
                ->where($where)
                ->field('a.*,ua.district as go_sheng,ua1.district as go_shi,
                        ua2.district as to_sheng,ua3.district as to_shi,
                        uuu.user_phone,uuu.user_username,uuu.user_real_name,uuu.user_username
                        ,ucz.zxlx_name,uch.hwlx_name')
                ->find();
        }else{
            $res = Db::table('up_order')->alias('a')
                ->join('up_car_hwlx uch','uch.hwlx_id = a.hwlx_id','left')
                ->join('up_area ua','ua.district_id = a.order_go_sheng','left')
                ->join('up_area ua1','ua1.district_id = a.order_go_shi','left')
                ->join('up_area ua2','ua2.district_id = a.order_to_sheng','left')
                ->join('up_area ua3','ua3.district_id = a.order_to_shi','left')
                ->join('up_u_user uuu','uuu.user_id = a.order_jms_user')
                ->join('up_car_zxlx ucz' ,'ucz.zxlx_id = a.zxlx_id','left')
                ->where($where)
                ->field('a.*,ua.district as go_sheng,ua1.district as go_shi,
                        ua2.district as to_sheng,ua3.district as to_shi,
                        uuu.user_phone,uuu.user_real_name,uuu.user_username
                        ,ucz.zxlx_name,uch.hwlx_name')
                ->find();
        }
        $map['order_id'] = $id;
        $info = Db::table('up_order_dot')->field('dot_id as id,dot_lon as lon,dot_lat as lat')->where($map)->select();
        $res['info'] = $info;
        return json(['status' => 200, 'msg' => $res]);
    }
    //取消订单
    public function qxOrder(){
        extract(input());
        $order_id = input('param.order_id');
        $info =Db::table('up_order')->where('order_id',$order_id)->find();
        if($info['order_status']>=6){
            return json(['status' => 100, 'msg' => "订单已经装箱,不能取消订单"]);
        }else{
            $res =Db::table('up_order')->where('order_id',$order_id)->setField('order_type',4);
            if($res){
                $district = Db::table('up_area')->where('district_id',$info['order_go_sheng'])->value('district');
                $go_shi = Db::table('up_area')->where('district_id',$info['order_go_shi'])->value('district');

                $district1 = Db::table('up_area')->where('district_id',$info['order_to_sheng'])->value('district');
                $to_shi = Db::table('up_area')->where('district_id',$info['order_to_shi'])->value('district');


                //插入消息表
                $dataList['n_title'] = "您的".$district.$go_shi.'--'.$district1.$to_shi."的订单已取消";
                $dataList['n_type'] =  2;
                $dataList['n_notice_type'] = 2;
                $dataList['n_user_id'] = ','.$info['order_jms_user'].','.$info['order_dirver_user'].',';
                $dataList['n_read'] = ',0,';
                $dataList['n_delete'] = ',0,';
                $dataList['n_time'] = date('Y-m-d H:i:s');
                $dataList['n_status'] = 2;
                Db::table('up_notice')->insertGetId($dataList);
                //司机定金
                $order_number = date('YmdHis') . str_pad(mt_rand(1, 99999999), 6, '0', STR_PAD_LEFT).$info['order_dirver_user'];
                $data4['user_id'] = $info['order_dirver_user'];
                $data4['balance_type'] = 2;
                $data4['balance_time'] = date('Y-m-d H:i:s');
                $data4['balance_title'] = $district.$go_shi.'--'.$district1.$to_shi.'订单定金返还';
                $data4['balance_num'] = $order_number;
                $data4['balance_price'] = $info['order_dzxy_yf'];
                $data4['balance_status'] = 2;
                $data4['balance_jia_jian'] = 1;
                Db::table('up_user_balance')->insertGetId($data4);
                Db::table('up_u_user')->where('user_id',$info['order_dirver_user'])->setInc('user_balance',$info['order_dzxy_yf']);
                //推送
                $list = $list1 = [];
//                array_push($list, $info['order_jms_user']);
                $v = (string)$info['order_jms_user'];
                $code=2;
                $str = array('msg'=>"您的".$district.'--'.$district1."的订单已取消",'type'=>8,'order_id'=>$order_id);
                $str1 = "您的".$district.'-'.$district1."的订单已取消";
                //推送加盟商
                try{
                    $this->Jpush1(1, $v, $str1, $str,$code);
                }catch(\Exception $e){}

                //推送司机
                if($info['order_dirver_user']!=''){
//                    array_push($list1, $info['order_dirver_user']);
                    $v1 = (string)$info['order_dirver_user'];

                    try{
                        $this->Jpush2(1, $v1, $str1, $str,$code);
                    }catch(\Exception $e){}
                }

                return json(['status'=>200,'msg'=>"取消订单成功"]);
            }else{
                return json(['status'=>200,'msg'=>"取消订单失败"]);
            }
        }
    }
    //询价单-企业确定
    public function queOrder(){
        extract(input());
        $order_id = input('param.order_id');
        $data['order_true'] =1;
        $data['order_status'] =5;
        $res = Db::table('up_order')->where('order_id',$order_id)->update($data);
        $list = Db::table('up_order')->where('order_id',$order_id)->find();
        if($res){
            $data2 = Db::table('up_u_user')->where('user_id',$list['order_dirver_user'])->find();
            $data1 = Db::table('up_u_user')->where('user_id',$list['order_jms_user'])->find();
            //插入消息表
            $dataList['n_title'] = '您的电子协议已被加盟商确认，请尽快赶往装货地点装货';
            $dataList['n_type'] =  2;
            $dataList['n_notice_type'] = 2;
            $dataList['n_user_id'] = ','.$list['order_dirver_user'].',';
            $dataList['n_read'] = ',0,';
            $dataList['n_delete'] = ',0,';
            $dataList['n_time'] = date('Y-m-d H:i:s');
            $dataList['n_status'] = 2;
            Db::table('up_notice')->insertGetId($dataList);
             YzxSms($data1['user_company_name'], $data2['user_phone'], '',562125);//发送验证码
            return json(['status'=>200,'msg'=>'确定成功']);
        }else{
            return json(['status'=>0,'msg'=>'确定失败']);
        }
    }

    //正常单-企业调整价格
    public function tiaoZ(){
        extract(input());
        $order_id = input('param.order_id');
        $order_go_sheng = input('param.order_go_sheng');//出发省
        $order_go_shi = input('param.order_go_shi');
        $order_go_qu = input('param.order_go_qu');
        $order_go_address = input('param.order_go_address');
        $order_go_lon = input('param.order_go_lon');
        $order_go_lat = input('param.order_go_lat');
        //目的地
        $order_to_sheng = input('param.order_to_sheng');
        $order_to_shi = input('param.order_to_shi');
        $order_to_qu = input('param.order_to_qu');
        $order_to_address = input('param.order_to_address');
        $order_to_lon = input('param.order_to_lon');
        $order_to_lat = input('param.order_to_lat');
        //货物
        $order_goods_name = input('param.order_goods_name');
        $order_goods_ton = input('param.order_goods_ton');
        $order_goods_m = input('param.order_goods_m');
        $order_freight = input('param.order_freight');
        $order_zf_type = input('param.order_zf_type');
        $order_zc_time = input('param.order_zc_time');
        $zxlx_id = input('param.zxlx_id');
        $cx_id = input('param.cx_id');
        $order_cc = input('param.order_cc');
        $hwlx_id = input('param.hwlx_id');
        $order_intro = input('param.order_intro');
        $order_goods_img = input('param.order_goods_img');

        $data['order_type'] = 2;
        $data['order_go_sheng'] = $order_go_sheng;
        $data['order_go_shi'] = $order_go_shi;
        $data['order_go_qu'] = $order_go_qu;
        $data['order_go_address'] = $order_go_address;
        $data['order_go_lon'] = $order_go_lon;
        $data['order_go_lat'] = $order_go_lat;
        $data['order_to_sheng'] = $order_to_sheng;
        $data['order_to_shi'] = $order_to_shi;
        $data['order_to_qu'] = $order_to_qu;
        $data['order_to_address'] = $order_to_address;
        $data['order_to_lon'] = $order_to_lon;
        $data['order_to_lat'] = $order_to_lat;
        $data['order_goods_name'] = $order_goods_name;
        $data['order_goods_ton'] = $order_goods_ton;
        $data['order_goods_m'] = $order_goods_m;
        $data['order_freight'] = $order_freight;
        $data['order_zf_type'] = $order_zf_type;
        $data['order_zc_time'] = $order_zc_time;
        $data['zxlx_id'] = $zxlx_id;
        $data['cx_id'] = $cx_id;
        $data['order_cc'] = $order_cc;
        $data['hwlx_id'] = $hwlx_id;
        $data['order_intro'] = $order_intro;
        $data['order_goods_img'] = $order_goods_img;
        $district = Db::table('up_area')->where('district_id',$order_to_sheng)->value('district');
        $data['order_quyu'] = myArea($district);
        $data['order_jujue_intro'] = '';
        $res = Db::table('up_order')->where('order_id',$order_id)->update($data);
        if($res){
            return json(['status'=>200,'msg'=>'调整成功']);
        }else{
            return json(['status'=>100,'msg'=>'调整失败']);
        }
    }
    public function dot(){
        extract(input());
        $order_id = input('param.order_id');
        $map['order_id'] = $order_id;
        $info = Db::table('up_order_dot')->field('dot_id as id,dot_lon as lon,dot_lat as lat')->where($map)->select();
        return json(['status'=>200,'msg'=>$info]);
    }
}